<?php


namespace app\model\vipshop;

use app\model\BaseModel;

class VipOrder extends BaseModel
{
    // 设置当前模型对应的完整数据表名称
    protected $connection = 'vip_shop';

    protected $table = 'ns_order';

    protected $pk = 'order_id';

    protected $dataSource = 2;

    //获取文档Id
    public function getDocIdAttr($value,$data)
    {
        return base64_encode($data['order_id'].'|vipshop');
    }

    //获取数据来源
    public function getDataSourceAttr($value,$data)
    {
        return $this->dataSource;
    }

    public function getIsDeletedAttr($value)
    {
        return $value ? 1 : 0;
    }

    public function getCreateTimeAttr($value)
    {
        return $value ? $value : 0;
    }

    public function getUpdateTimeAttr($value)
    {
        return $value ? $value : 0;
    }

    public function OrderItem()
    {
        return $this->hasMany('VipOrderGoods','order_id');
    }
}